package com.mistyrain.controller;

import com.mistyrain.entity.User;
import com.mistyrain.entity.UserVO;
import com.mistyrain.feign.OrderFeign;
import com.mistyrain.feign.UserFeign;
import com.mistyrain.service.OrderService;
import com.mistyrain.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
@RequestMapping("/user")
public class UserHandler {
    @Autowired
    private UserService userService;

    @GetMapping("/findAll")
    @ResponseBody
    public UserVO findAll(@RequestParam("page") int page, @RequestParam("limit") int limit){
        return userService.findAll(page,limit);
    }

    @PostMapping("/save")
    public String save(User user){
        return userService.save(user);
    }

    @GetMapping("/deleteById/{id}")
    public String deleteById(@PathVariable("id") long id){
        return userService.deleteById(id);
    }
}
